import request from '/@/utils/request';
import other from '/@/utils/other';

const headers = {
	onlyData: true,
};
export const dicListApi = (type: String) => {
	return request({
		url: `/admin/dict/type/${type}`,
		method: 'get',
		headers,
	});
};
//文件上传
export const fileUploadApi = (data: any) => {
	return request({
		url: other.adaptationUrl('/admin/sys-file/upload'),
		headers: {
			'Content-Type': 'multipart/form-data',
		},
		method: 'POST',
		data,
	});
};
//文件删除
export const fileDeleteApi = (data: any) => {
	return request({
		url: `/admin/sys-file`,
		headers: {
			showSuccessMessage: true,
		},
		method: 'DELETE',
		data,
	});
};
//文件下载
export const fileDownloadApi = (params: any) => {
	return request({
		url: `/admin/sys-file/oss/file/byId`,
		responseType: 'blob',
		method: 'get',
		params,
	});
};
export const dicTreeListApi = (type: String) => {
	return request({
		url: `/admin/dict/tree/type/${type}`,
		method: 'get',
		headers,
	});
};
